import fetch from 'common/src/utils/fetch'

const api = {
  // 提交毕业设计 查询列表
  getList(data) {
    return fetch({
      url: '/api/designservice/docDissertation/list',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 审核毕业设计 查询列表
  getReviewList(data) {
    return fetch({
      url: '/api/designservice/docDissertation/getTutorTask',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    });
  },
  // 查看毕业设计 查询列表
  getViewList(data) {
    return fetch({
      url: '/api/designservice/docDissertation/getAdminTask',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查学生开题报告详情
  getReportDetail(data) {
    return fetch({
      url: `/api/designservice/openReport/reportInfo`,
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查课题名称信息
  getSubjectDetail(data) {
    return fetch({
      url: '/api/designservice/common/project',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查学生信息
  getStudentInfo(data) {
    return fetch({
      url: '/api/designservice/common/studentInfo',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 文件下载
  downloadFile(data) {
    return fetch({
      url: '/api/baseresservice/obsfile/downloadfile',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 保存毕业设计
  save(data) {
    return fetch({
      url: '/api/designservice/docDissertation/add',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 编辑毕业设计
  update(data) {
    return fetch({
      url: '/api/designservice/docDissertation/edit',
      method: 'put',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 提交毕业设计
  submit(data) {
    return fetch({
      url: '/api/designservice/docDissertation/createFlow',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 删除毕业设计
  delete(data) {
    return fetch({
      url: '/api/designservice/docDissertation/delete',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 审核通过(驳回) 撤销
  approval(data) {
    return fetch({
      url: '/api/designservice/docDissertation/approval',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查毕业设计（论文）详情
  getDesignDetail(data) {
    return fetch({
      url: '/api/designservice/common/report',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 导出 先得到key
  export(data) {
    return fetch({
      url: '/api/designservice/docDissertation/export',
      method: 'post',
      data
    })
  },
  // 查毕业设计（论文）导出状态
  getDesignExportStatus(key) {
    return fetch({
      url: `/api/designservice/common/asyncProcessResult/${key}`,
      method: 'get',
      showMask: false
    })
  },
  // 获取导出文件流
  getExportData(key) {
    return fetch({
      url: `/api/designservice/docDissertation/exportDissertation/${key}`,
      method: 'get',
      responseType: 'blob',
      showMask: false
    })
  },
  getExportStatus(key) {
    return fetch({
      url: `/api/designservice/common/exportExcelResult/${key}`,
      method: 'get',
      showMask: false
    })
  },
  // 查学院
  getCollege() {
    let authId = localStorage.getItem('activeAuthId')
    return fetch({
      url: `/api/designservice/common/college?authId=${authId}`,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  // 根据毕业年份和学院查专业
  getSubject(data) {
    return fetch({
      url: '/api/designservice/common/findSubject',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查审核进度
  getProgress(applyNo) {
    return fetch({
      url: `/api/workflow/approval/selectApproFlow?no=${applyNo}`,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  // 查课题来源
  getSource(data) {
    return fetch({
      url: '/api/designservice/settingSubjectSource/queryOptionsByYear',
      method: 'post',
      headers: { 'Content-Type': 'application/json' },
      data
    });
  },
  // 毕业设计相关打印 查列表
  getPrintList(data) {
    return fetch({
      url: '/api/designservice/docRelatedPrint/queryByPage',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 新增 毕业设计打印
  printSave(data) {
    return fetch({
      url: '/api/designservice/docRelatedPrint/insert',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 编辑 毕业设计打印
  printUpdate(data) {
    return fetch({
      url: '/api/designservice/docRelatedPrint/update',
      method: 'put',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 删除 毕业设计打印
  printDelete(data) {
    return fetch({
      url: '/api/designservice/docRelatedPrint/delete',
      method: 'delete',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 文件删除
  deleteFile(path) {
    return fetch({
      url: `/api/commonservice/obsfile/deleteFile?objectkey=${path}`,
      method: 'delete',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  }
}

export default api
